<div class="bigtitle">Sản phẩm &gt; <?=lang('label_addnew')?></div>
<table class='tblcontent' cellspacing='0' cellpadding='0' border='0'>
	<tr>
		<td>
			<?=form_open_multipart(site_url('vat_lieu_xay_dung/update'),array('name'=>'frm','onsubmit'=>'return f_validate()'),array('hidden_status'=>'','hidden_id'=>$detail->id))?>			
			<table class='tblinputform' cellspacing='1' cellpadding='2' border='0' width='100%'>
				<tr>
					<th width='10%'>Nhóm sản phẩm</th>
					<td width='90%'>
						<select name='cbo_category'>
							<option value="0">Chọn nhóm sản phẩm</option>
							<? for($i=0;$i<count($category);$i++){ ?>
							<option value="<?=$category[$i]->id?>" <?=($detail->categoryid==$category[$i]->id?'selected="selected"':'')?>><?=form_prep($category[$i]->name)?></option>
							<? } ?>
						</select>
					</td>
				</tr> 
				<tr>
					<th>Hình cũ</th>
					<td><img width="120" height="100" src="<?=base_url().$this->config->item('product_img_path').$detail->image?>" /></td>
				</tr>
                <tr>
					<th><?=lang('news_image')?></th>
					<td><input type="file" name="txt_image" size="20"/></td>
				</tr>
				<tr>
					<th>Tên sản phẩm</th>
					<td><input type='text' name='txt_name' style='width:300px;'  value='<?=form_prep($detail->name)?>' /></td>
				</tr>
				<tr>
					<th>Giá</th>
					<td><input type="text" name='txt_price' style='width:300px;' value='<?=form_prep($detail->price)?>' /></td>
				</tr>
                 <tr>
					<th>Đơn vị tính</th>
					<td><input type="text" name='txt_unit' style='width:300px;'value='<?=form_prep($detail->unit)?>' />  </td>
				</tr>
                <tr>
					<th>Nhà cung cấp</th>
					<td><input type='text' name='txt_supplier' style='width:300px;' value='<?=form_prep($detail->supplier)?>'  /></td>
				</tr>
                 <tr>
					<th>Kích hoạt</th>
					<td><input type='checkbox' name='chk_active' value='' <?=$detail->active==1?"checked=\"checked\"":""?> /></td>
				</tr>
                <tr>
					<th>Chi tiết</th>
					<td><?=form_fckeditor('txt_description',$detail->description,300)?></td>
				</tr>
			</table>
			<div class='ctrlbtn'>
				<input type='button' name='btn_save' value='<?=lang('label_save')?>' onclick='return f_validate()'/>	
				<input type='button' name='btn_cancel' value='<?=lang('label_cancel')?>' onclick='window.location="<?=site_url('vat_lieu_xay_dung')?>";'/>
			</div>
			<?=form_close()?>
		</td>
	</tr>
</table>
<script type='text/javascript'>
	f_onload();
	function f_onload(){ document.frm.cbo_category.focus();}
	function f_validate(){
		form = document.frm;
		if( form.cbo_category  && form.cbo_category.value==0){
			alert("Vui lòng chọn nhóm dự án");
			form.cbo_category.focus();
			return false;
		}
		if(form.txt_name.value==0){
			alert("Vui lòng nhập tên dự án");
			form.txt_name.focus();
			return false;
		}
		if(form.txt_unit.value==0){
			alert("Vui lòng nhập đơn vị tính");
			form.txt_location.focus();
			return false;
		}
		form.submit();
	}
</script>